﻿namespace OpenPms.Data;
public enum EOrderStatus
{
    登记,
    入住,
    退房//改动值PCheckout存储过程需要同步改动
}
public class TOrderBase : TBase
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.None)]
    [Display(Name = "订单号")]
    public Guid Id { get; set; }
    [Display(Name = "状态")]
    public EOrderStatus OrderStatus { get; set; }
    public Guid RoomTypeId { get; set; }
    [StringLength(32)]
    [Display(Name = "房型")]
    public string RoomTypeName { get; set; } = default!;
    [StringLength(32)]
    [Display(Name = "房号")]
    public string RoomNo { get; set; } = "";
    [DisplayName("脏房")]
    public bool IsDirty { get; set; }
    [Display(Name = "入住时间")]
    public DateTime? DTCheckIn { get; set; }
    [Display(Name = "退房时间")]
    public DateTime? DTCheckOut { get; set; }
    [Display(Name = "备注")]
    public string? Memo { get; set; }
    [Display(Name = "预订单号")]
    public Guid ReservationId { get; set; }
}
/// <summary>
/// 预订多个房间生成一条记录
/// 同住人没有订单记录
/// </summary>
public class TOrder : TOrderBase
{

    [DisplayName("客人")]
    public List<TGuest> Guests { get; set; } = default!;
    [ForeignKey(nameof(ReservationId))]
    public TReservation Reservation { get; set; } = default!;


    public TOrder() { }

    public TOrder(Guid roomTypeId, string roomTypeName, DateTime dTCheckIn, DateTime dTCheckOut, string? memo, Guid reservationId, string roomNo = "", bool isDirty = false)
    {
        Id = Guid.NewGuid();
        OrderStatus = EOrderStatus.登记;
        RoomTypeId = roomTypeId;
        RoomTypeName = roomTypeName;
        RoomNo = roomNo;
        IsDirty = isDirty;
        DTCheckIn = dTCheckIn;
        DTCheckOut = dTCheckOut;
        Memo = memo;
        ReservationId = reservationId;
    }
}

